package edu.mcw.rgd.clinminer.umls.type;

import edu.mcw.rgd.clinminer.data.ClinminerException;

public class LocalCode {

	private String code;

	public LocalCode(String code) throws ClinminerException {
		if (code != null) {
			this.code = code;
		} else {
			throw new ClinminerException("Invalid Local code " + code);
		}

	}

	@Override
	public String toString() {
		return code;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		LocalCode other = (LocalCode) obj;
		if (code == null) {
			if (other.code != null) {
				return false;
			}
		} else if (!code.equals(other.code)) {
			return false;
		}
		return true;
	}

}
